
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台登陆</title>
    <link rel="stylesheet" href="./static/common/layui/css/layui.css">
    <link rel="stylesheet" href="./static/admin/css/login.css">
    <script src="./static/common/layui/layui.js"></script>
</head>

<body id="login">
<div class="login">
    <h2>后台登陆</h2>
    <form class="layui-form" method="post" target="_blank" action="">
        <div class="layui-form-item">
            <input type="username" name="account" placeholder="用户名" class="layui-input">
            <i class="layui-icon input-icon">&#xe66f;</i>
        </div>
        <div class="layui-form-item">
            <input type="password" name="password" placeholder="密码"  class="layui-input">
            <i class="layui-icon input-icon">&#xe673;</i>
        </div>
<!--        <div class="layui-form-item">-->
<!--            <input type="checkbox" name="box" lay-skin="primary" title="记住密码" checked=""> <a class="back" href="javascript:;"  style="margin-top: 10px">忘记密码</a>-->
<!--        </div>-->
        <div class="layui-form-item">
            <button style="width: 100%" class="layui-btn" lay-submit lay-filter="login">立即登录</button>

        </div>
    </form>

    <script>


        layui.use('form', function () {
            var form = layui.form,
                layer = layui.layer,
                $ = layui.jquery;



            form.on('submit(login)', function (data) {

                var data = data.field;
                $.ajax({
                    url:"/watchsystem/admin/login",
                    data:data,
                    method:'post',
                    success:function(data){
                        if(data.code == 200){
                            window.location.href="product_list.html"
                        }else {
                            layer.msg(data.msg)
                        }
                    }
                })


                return false;
            });
        });
    </script>
</div>
</body>

</html>
